﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_MasterPages/AdminMasterPage.master"
    AutoEventWireup="true" CodeFile="Gallery.aspx.cs" Inherits="Admin_Gallery" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeaderContentPlaceHolder" runat="Server">
    <link href="~/Guest/Gallery/css/visuallightbox.css" rel="stylesheet" type="text/css" />
    <link href="~/Guest/Gallery/css/vlightbox6.css" rel="stylesheet" type="text/css" />
    <script src="~/Guest/Gallery/js/visuallightbox.js" type="text/javascript"></script>
    <script src="~/Guest/Gallery/js/vlbdata6.js" type="text/javascript"></script>
    <script src="~/Guest/Gallery/js/jquery.min.js" type="text/javascript"></script>
    <link href="../App_Themes/Default/css/TableStyles.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript">
        function CheckName(sender, e) {
            var maxUplouder = document.getElementById("<%=MaxPicFileUpload.ClientID %>");
            var minUplouder = document.getElementById("<%=MinPicFileUpload.ClientID %>");
            if (maxUplouder != "") {
                var maxFilepath = maxUplouder.value;
                var maxFilename = maxFilepath.substring(maxFilepath.lastIndexOf('\\') + 1).toLowerCase();
                var minFilepath = minUplouder.value;
                var minFilename = minFilepath.substring(minFilepath.lastIndexOf('\\') + 1).toLowerCase();
                if (minFilename != maxFilename) {
                    alert("نام دو تصویر باید یکسان باشد");
                    e.IsValid = false;
                    return;
                }
            }
            e.IsValid = true;
        }        
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContentPlaceHolder" runat="Server">
    <div id="templatemo_middle_subpage" dir="rtl" align="center">
        <h2>
            گالری</h2>
    </div>
    <div id="templatemo_main" dir="rtl">
        <div class="col_w900 col_w900_last">
            <table style="width: 100%" title="گالری">
                <tr>
                    <td>
                        <table>
                            <tr>
                                <td style="width: 300px;" valign="top" align="right">
                                    <asp:MultiView ID="ImageMultiView" runat="server">
                                        <asp:View ID="NoFileView" runat="server">
                                            <p>
                                                تصویری در مسیر فایل های گالری وجود ندارد
                                            </p>
                                        </asp:View>
                                        <asp:View ID="FileView" runat="server">
                                            <div style="overflow: auto; height: 300px; border-left: 1px gray solid;
                                                border-bottom: 1px gray solid; padding: 0px; margin: 0px">                                              
                                                    <asp:Table ID="ImageTable" runat="server">
                                                    </asp:Table>
                                                </div>
                                        </asp:View>
                                    </asp:MultiView>
                                </td>
                                <td style="width: 20px">
                                </td>
                                <td valign="top" align="center">
                                    <table border="0" cellpadding="0" cellspacing="0" style="width: 500px">
                                        <tr valign="middle">
                                            <td style="width: 80px" align="right">
                                                تصویر کوچک:
                                            </td>
                                            <td style="width: 380px" align="right" dir="rtl">
                                                <asp:FileUpload ID="MinPicFileUpload" runat="server" Width="350px" />
                                                <asp:RequiredFieldValidator ID="MinRequiredFieldValidator" runat="server" ErrorMessage="*"
                                                    ControlToValidate="MinPicFileUpload" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr valign="middle">
                                            <td style="width: 80px" align="right">
                                                تصویر بزرگ:
                                            </td>
                                            <td style="width: 380px" align="right" dir="rtl">
                                                <asp:FileUpload ID="MaxPicFileUpload" runat="server" Width="350px" />
                                                <asp:RequiredFieldValidator ID="MaxRequiredFieldValidator" runat="server" ErrorMessage="*"
                                                    ControlToValidate="MaxPicFileUpload" ValidationGroup="Insert"></asp:RequiredFieldValidator>
                                            </td>
                                        </tr>
                                        <tr valign="middle">
                                            <td style="width: 80px" align="right">
                                            </td>
                                            <td style="width: 380px" align="right" dir="rtl">
                                                <asp:CustomValidator ID="fileNameCustomValidator" ValidationGroup="Insert" ControlToValidate="MaxPicFileUpload"
                                                    runat="server" ClientValidationFunction="CheckName" ErrorMessage="نام دو تصویر باید یکسان باشد"></asp:CustomValidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2" align="left">
                                                <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">
                                                    <tr>
                                                        <td style="height: 15px">
                                                            &nbsp;
                                                        </td>
                                                        <td align="left" valign="top" style="width: 80px;">
                                                        </td>
                                                        <td align="left" valign="top" style="width: 80px;">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td style="height: 15px">
                                                            &nbsp;
                                                        </td>
                                                        <td align="left" valign="top" style="width: 80px;">
                                                            <asp:ImageButton ID="InsertButton" runat="server" CommandName="Insert" SkinID="InsertButton"
                                                                ValidationGroup="Insert" OnClick="InsertButton_Click" />
                                                        </td>
                                                    </tr>
                                                </table>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
            </table>
        </div>
    </div>
</asp:Content>
